<%-- 
    Document   : CustomerEditForm
    Created on : 1 févr. 2010, 15:50:35
    Author     : JC
--%>
<%@page contentType="text/html" pageEncoding="UTF-8" import="fr.uha.ensisa.kfetmanager.customer.*, java.util.*, java.text.DateFormat"%>
<%
            Customer customer;
            try {
                customer = (Customer) getServletContext().getAttribute("customer");
            } catch (Exception e) {
                getServletContext().setAttribute("errorMessage", "Objet Customer null");
                getServletContext().setAttribute("redirectTo", "/admin/customers");
                getServletContext().getRequestDispatcher("/error.jsp").forward(request, response);
                return;
            }
%>
<div>
    <h4>Edition client</h4>
    <form method="POST" action="<%= getServletContext().getContextPath()%>/admin/customers/edit">
        <input type="hidden" name="id" value="<%= customer.getId().toString()%>"/>
        <jsp:include page="CustomerForm.jsp">
            <jsp:param name="edit" value="true"/>
        </jsp:include>
        Solde : <%= String.valueOf(customer.getBalance())%> €<br/>
        Date cr&eacute;ation : <%= DateFormat.getDateInstance(DateFormat.MEDIUM).format(customer.getCreationDate())%>
        <br/><input type="submit" value="Sauvegarder"/>
    </form>
    <p>
        <a href="<%=getServletContext().getContextPath()%>/admin/customers/delete?id=<%= customer.getId().toString()%>">Supprimer client</a>
    </p>
</div>